import { createRouter, createWebHistory } from 'vue-router'
import AdminHome from '@/views/admin/AdminHome.vue'
import Login from '@/views/Login.vue'
import updatePasswordPage from '@/views/updatePasswordPage.vue'
import personCenterPage from '@/views/personCenterPage.vue'
import UserHome from '@/views/user/UserHome.vue'
import userRegisterPage from '@/views/userRegisterPage.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'login',
      component: Login,
    },
    // 管理员端
    {
      path: '/admin/home',
      component: AdminHome,
    },
    {
      path: '/user/personCenter',
      name: '用户中心',
      component: personCenterPage,
    },
    {
      path: '/user/updatePassword',
      name: '修改密码',
      component: updatePasswordPage,
    },
    // 用户端
    {
      path: '/user/home',
      name: 'home',
      component: UserHome,
    },
    {
      path: '/user/login',
      name: '用户登陆',
      component: Login,
    },
    {
      path: '/user/register',
      name: '用户注册',
      component: userRegisterPage,
    },
  ],
})

export default router
